package backend.project.gym_management.mapper;

import backend.project.gym_management.pojo.dto.*;
import backend.project.gym_management.pojo.vo.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface AdminMapper {
    List<AdminQueryCoachIntroductionVO> queryCoachIntroduction(AdminQuery adminQuery);

    List<AdminQueryCourseVO> queryCourse(AdminQuery adminQuery);

    List<AdminQueryCourseIntroductionVO> queryCourseIntroduction(AdminQuery adminQuery);

    List<AdminQueryEmployeeVO> queryEmployee(AdminQuery adminQuery);

    List<AdminQueryEnrollmentVO> queryEnrollment(AdminQuery adminQuery);

    List<AdminQueryEquipmentVO> queryEquipment(AdminQuery adminQuery);

    List<AdminQueryHealthDataVO> queryHealthData(AdminQuery adminQuery);

    List<AdminQueryOrderVO> queryOrder(AdminQuery adminQuery);

    List<AdminQueryPaymentRecordVO> queryPaymentRecord(AdminQuery adminQuery);

    List<AdminQueryRepairStatusVO> queryRepairStatus(AdminQuery adminQuery);

    List<AdminQueryUserVO> queryUser(AdminQuery adminQuery);
    // 删除表数据
    int deleteCoachIntroduction(@Param("tableName") String tableName, @Param("id") Integer id);
    int deleteCourse(AdminDeleteParam adminDelete);
    int deleteCourseIntroduction(@Param("tableName") String tableName, @Param("id") Integer id);
    int deleteEmployee(AdminDeleteParam adminDelete);
    int deleteEnrollment(@Param("tableName") String tableName, @Param("cid") Integer id,@Param("uid")Integer uid);
    int deleteEquipment(AdminDeleteParam adminDelete);
    int deleteHealthData(@Param("tableName") String tableName, @Param("id") Integer id);
    int deleteOrder(@Param("tableName") String tableName, @Param("id") Integer id);
    int deletePaymentRecord(@Param("tableName") String tableName, @Param("id") Integer id);
    int deleteRepairStatus(@Param("tableName") String tableName, @Param("id") Integer id);
    int deleteUser(AdminDeleteParam adminDelete);

    // 新增表数据
    int insertUser(UserAddDTO dto);
    int insertEmployee(EmployeeAddDTO dto);
    int insertHealthData(HealthDataAddDTO dto);
    int insertEquipment(EquipmentAddDTO dto);
    int insertCourse(CourseAddDTO dto);
    int insertEnrollment(EnrollmentAddDTO dto);
    int insertRepairStatus(RepairStatusAddDTO dto);
    int insertCourseIntroduction(CourseIntroductionAddDTO dto);
    int insertCoachIntroduction(CoachIntroductionAddDTO dto);
    int insertOrder(OrderAddDTO dto);
    int insertPaymentRecord(PaymentRecordAddDTO dto);

    // 修改表数据
    int updateUser(UserUpdateDTO dto);
    int updateEmployee(EmployeeUpdateDTO dto);
    int updateHealthData(HealthDataUpdateDTO dto);
    int updateEquipment(EquipmentUpdateDTO dto);
    int updateCourse(CourseUpdateDTO dto);
    int updateEnrollment(EnrollmentUpdateDTO dto);
    int updateRepairStatus(@Param("dto") RepairStatusUpdateDTO dto);
    int updateCourseIntroduction(CourseIntroductionUpdateDTO dto);
    int updateCoachIntroduction(CoachIntroductionUpdateDTO dto);
    int updateOrder(OrderUpdateDTO dto);
    int updatePaymentRecord(PaymentRecordUpdateDTO dto);
    // 批量删除表数据
    int batchDeleteCourse(@Param("tableName") String tableName, @Param("ids") List<Integer> ids);
    int batchDeleteUser(@Param("tableName") String tableName, @Param("ids") List<Integer> ids);
    int batchDeleteCourseIntroduction(@Param("tableName") String tableName, @Param("ids") List<Integer> ids);
    int batchDeleteEmployee(@Param("tableName") String tableName, @Param("ids") List<Integer> ids);
    int batchDeleteRepairStatus(@Param("tableName") String tableName, @Param("ids") List<Integer> ids);
    int batchDeleteEquipment(@Param("tableName") String tableName, @Param("ids") List<Integer> ids);
    int batchDeleteCoachIntroduction(@Param("tableName") String tableName, @Param("ids") List<Integer> ids);
    int batchDeleteEnrollment(@Param("pairs")List<AdminBatchDeleteParam.EnrollmentPair> pairs);

    // 检查eid是否对应“教练”类型员工
    Integer checkCoachExist(Integer eid);
    // 检查教练简介是否存在
    Integer checkCoachIntroductionExist(Integer eid);
    Integer checkCidExist(Integer cid);
    Integer checkIntroductionExist(Integer cid);
    Integer checkEquipmentExist(Integer seid);
    Integer checkRepairStatusExist(Integer seid);
    Integer checkUidExist(@Param("uid") Integer uid);



    // 在 AdminMapper 接口中添加
    List<AdminQueryPayOrderVO> queryPayOrder(AdminQuery query);
    int deletePayOrder(@Param("id") Long oid);
    int batchDeletePayOrder(@Param("ids") List<Long> ids);
    int insertPayOrder(PayOrderAddDTO dto);
    int updatePayOrder(PayOrderUpdateDTO dto);

}
